{template header}

<style>
	.m-success, .m-warn, .m-error {
		background: url("{ADMIN_WEBURLPATH}/images/ico-pa.png") no-repeat scroll 0 0 transparent;
		padding-left: 20px;
		
	}
	.m-success {
		background-position: -164px -390px;
	}
	.m-warn {
		background-position: -59px -480px;
	}
	.m-error {
		background-position: -124px -420px;
	}
</style>

<!--{if $webglobal[mode]=='couponedit'}-->
	<script type="text/javascript" charset="utf-8" src="{ADMIN_WEBURLPATH}/images/calendar.js"></script>
	<script type="text/javascript" charset="utf-8" src="{WEBURLPATH}/editor/kindeditor-min.js"></script>
	<script type="text/javascript" charset="utf-8" src="{WEBURLPATH}/javascript/jquery.optionTree.js"></script>
	<table class="menutable" cellspacing="1">
		<thead>
			<tr><td>优惠劵管理</td></tr>
		</thead>
		<tbody>
			<tr><td>
				<a href="{ADMIN_WEBURLPATH}/index.php?mode=coupon&{$webrequest[gourl]}">[优惠劵列表]</a>
			</td></tr>
		</tbody>
	</table>

	<form name="editform" method="post" enctype="multipart/form-data" action="{ADMIN_WEBURLPATH}/index.php?mode=couponedit&check&gourl={$webglobal[file_coupon][gourlencode]}">
	<input type="hidden" name="editid" value="{$webrequest[editid]}" />
	<table class="datatable" cellspacing="1">
		<thead>
			<tr><td colspan="2">修改优惠劵</td></tr>
		</thead>
		<tbody>
			<tr>
				<th>优惠劵分类<span class="need"> *</span></th>
				<td>
					<select name="coupon_category_id">
						<option value="0">选择分类...</option>
						<!--{loop $webglobal['file_coupon']['category'] $categoryID $option}-->
						<option value="{$categoryID}">{$option[showName]}</option>
						<!--{/loop}-->
					</select>
					<script type="text/javascript">common_CheckedSelect('coupon_category_id', '{$webglobal[file_coupon][editinfo][coupon_category_id]}');</script>
				</td>
			</tr>
			<tr>
				<th>状态<span class="need"> *</span></th>
				<td>
					<select name="status">
						<option value="999">选择状态...</option>
						<option value="1">审核通过</option>
						<option value="0">待审核</option>
						<option value="-1">已删除</option>
					</select>
					<script type="text/javascript">common_CheckedSelect('status', '{$webglobal[file_coupon][editinfo][status]}');</script>
				</td>
			</tr>
			<tr>
				<th>特殊优惠劵</th>
				<td>
					<input type="checkbox" name="special" id="special" value="1"{if $webglobal[file_coupon][editinfo][special]==1} checked="checked"{/if} /><label for="special">设为特殊优惠劵</label>
				</td>
			</tr>
			<tr>
				<th>优惠劵名称</th>
				<td>
					<input type="text" name="name" size="70" value="{$webglobal[file_coupon][editinfo][name]}" />
				</td>
			</tr>
			<tr>
				<th>图片<div>格式：jpg,gif,png</div></th>
				<td>
					<input type="file" name="image" size="40" /><!--{if $webglobal[file_coupon][editinfo][image]!=''}-->&nbsp;&nbsp;<img src="{WEBURLPATH}{$webglobal[file_coupon][editinfo][image]}" height="50" alt="" border="0" /><input type="checkbox" name="image_del" id="image_del" value="1" /><label for="image_del">删除当前图片</label><!--{/if}-->
				</td>
			</tr>
			<tr>
				<th>原价</th>
				<td>
					<input type="text" name="original" size="10" value="{$webglobal[file_coupon][editinfo][original]}" />
				</td>
			</tr>
			<tr>
				<th>优惠价</th>
				<td>
					<input type="text" name="price" size="10" value="{$webglobal[file_coupon][editinfo][price]}" />
				</td>
			</tr>
			<tr>
				<th>开始时间</th>
				<td>
					<input type="text" name="starttime" style="width:200px;" value="{$webglobal[file_coupon][editinfo][starttime_show]}" onfocus="c.showMoreDay=false;c.show(this);" />
				</td>
			</tr>
			<tr>
				<th>结束时间</th>
				<td>
					<input type="text" name="endtime" style="width:200px;" value="{$webglobal[file_coupon][editinfo][endtime_show]}" onfocus="c.showMoreDay=false;c.show(this);" />
				</td>
			</tr>
			<tr>
				<th>优惠劵介绍<span class="need"> *</span></th>
				<td>
					<script>
						KE.show({
							id : 'introduction',
							items : ['source', '|', 'undo', 'redo', 'cut', 'copy', 'paste',
									'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
									'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
									'superscript', '|', 'selectall', 'fullscreen', '-',
									'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold',
									'italic', 'underline', 'strikethrough', 'removeformat', '|', 'image',
									'flash', 'media', 'advtable', '|', 'link', 'unlink', '|', 'pagebreak'],
							imageUploadJson : '{WEBURLPATH}/editor/editorup.php?upfrom=coupon',
							resizeMode : 1
						});
					</script>
					<textarea id="introduction" name="introduction" style="width:100%;height:300px;">{$webglobal[file_coupon][editinfo][introduction]}</textarea>
				</td>
			</tr>
			<tr>
				<th>其他信息</th>
				<td>
					发布时间:{$webglobal[file_coupon][editinfo][pubtime_show]}<br />
					收藏次数:{$webglobal[file_coupon][editinfo][favorites_num]}
				</td>
			</tr>
		</tbody>
		<tfoot>
			<tr><td colspan="2">
				<input type="submit" name="adminsubmit" class="submitok" value=" 确  认 " />&nbsp;&nbsp;
				<input type="reset" name="adminreset" value=" 取  消 " />
			</td></tr>
		</tfoot>
	</table>
	</form>

<!--{elseif $webglobal[mode]=='words'}-->
	<table class="menutable" cellspacing="1">
		<thead>
			<tr><td>敏感词管理</td></tr>
		</thead>
		<tbody>
			<tr><td>
				<a href="{ADMIN_WEBURLPATH}/index.php?mode=wordsadd">[添加敏感词]</a>
			</td></tr>
		</tbody>
	</table>

	<form name="searchform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=words">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr>
				<td colspan="3">搜索敏感词</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th style="width: 100px;">搜索选项</th>
				<td>
					关键字:<input type="text" name="searchkey" value="$webglobal[CPP][searchkey]" size="50" />
				</td>
				<td style="width: 100px; text-align: center"><input type="submit" name="searchsubmit" value=" 搜  索 " /></td>
			</tr>
		</tbody>
	</table>
	</form>

	<form name="editform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=wordsup&check&gourl={$webglobal[file_coupon][gourlencode]}">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr>
				<th width="5%"></th>
				<th>不良词语</th>
				<th>替换词</th>
			</tr>
		</thead>
		<tbody>
			<!--{if $webglobal[file_coupon][datanum]>0}-->
				<!--{loop $webglobal[file_coupon][dataarray] $tempkey $temptable}-->
					<tr>
						<td{$temptable[tdclass]}><input type="checkbox" name="delid[]" value="{$tempkey}" /></td>
						<td{$temptable[tdclass]}>
							<input type="text" size="30" name="find[{$tempkey}]" value="{$temptable[find]}" />
						</td>
						<td{$temptable[tdclass]}>
							<input type="text" size="30" name="replacement[{$tempkey}]" value="{$temptable[replacement]}" />
						</td>
					</tr>
				<!--{/loop}-->
			<!--{else}-->
				<tr><td colspan="3" style="text-align: center">还没有敏感词过滤表。</td></tr>
			<!--{/if}-->
		</tbody>
	</table>

	<!--{if $webglobal[file_coupon][datanum]>0}-->
		<table style="width:100%;border-style:none;" cellpadding="0" cellspacing="0">
			<tr>
				<td style="width:80px;margin:0;padding:0;"><input type="submit" name="adminsubmit" value=" 批量更改 " /></td>
				<td style="text-align:right;margin:0;padding:5px 0;">{template page}</td>
			</tr>
		</table>
	<!--{/if}-->
	</form>
<!--{elseif $webglobal[mode]=='wordsadd'}-->
	<table class="menutable" cellspacing="1">
		<thead>
			<tr><td>敏感词管理</td></tr>
		</thead>
		<tbody>
			<tr><td>
				<a href="{ADMIN_WEBURLPATH}/index.php?mode=words">[敏感词列表]</a>
			</td></tr>
		</tbody>
	</table>

	<form name="addform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=wordsadd&check">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr><td colspan="2">添加敏感词</td></tr>
		</thead>
		<tbody>
			<tr>
				<th>不良词<span class="need"> *</span></th>
				<td>
					<input type="text" name="find" size="30" value="" />
				</td>
			</tr>
			<tr>
				<th>替换词<span class="need"> *</span></th>
				<td>
					<input type="text" name="replacement" size="30" value="" />
				</td>
			</tr>
		</tbody>
		<tfoot>
			<tr><td colspan="2">
				<input type="submit" name="adminsubmit" class="submitok" value=" 确  认 " />&nbsp;&nbsp;
				<input type="reset" name="adminreset" value=" 取  消 " />
			</td></tr>
		</tfoot>
	</table>
	</form>
<!--{elseif $webglobal[mode]=='coupon'}-->

	<script type="text/javascript" src="{WEBURLPATH}/javascript/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
	<script type="text/javascript" src="{WEBURLPATH}/javascript/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<script type="text/javascript" src="{WEBURLPATH}/javascript/jqueryPlugin.js"></script>
	<link rel="stylesheet" type="text/css" href="{WEBURLPATH}/javascript/fancybox/jquery.fancybox-1.3.4.css" media="screen" />

	<form name="searchform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=coupon">
	<table class="datatable" cellspacing="1">
		<thead>
			<tr>
				<td colspan="3">搜索优惠劵</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<th style="width: 100px;">搜索选项</th>
				<td>
					<select name="class">
						<option value="0">-- 全部分类 --</option>
						<!--{loop $webglobal[file_coupon][category] $categoryID $option}-->
							<option value="{$categoryID}">{$option[showName]}</option>
						<!--{/loop}-->
					</select>
					<select name="status">
						<option value="999">-- 全部状态 --</option>
						<option value="1">审核通过</option>
						<option value="0">待审核</option>
						<option value="-1">已删除</option>
					</select>
					<script type="text/javascript">
						common_CheckedSelect('class', '{$webglobal[CPP][class]}');
						common_CheckedSelect('status', '{$webglobal[CPP][status]}');
					</script>
					关键字:<input type="text" name="searchkey" value="$webglobal[CPP][searchkey]" size="50" />
				</td>
				<td style="width: 100px; text-align: center"><input type="submit" name="searchsubmit" value=" 搜  索 " /></td>
			</tr>
		</tbody>
	</table>
	</form>

	<form id ="couponform" name="editform" method="post" action="{ADMIN_WEBURLPATH}/index.php?mode=couponup&check&gourl={$webglobal[file_coupon][gourlencode]}">
	<table class="datatable" cellspacing="1" id="audit">
		<thead>
			<tr>
				<th width="7%"></th>
				<th width="10%">状态</th>
				<th>图片</th>
				<th>特别</th>
				<th>分类</th>
				<th>所属商家</th>
				<th>优惠劵详情</th>
				<th><a href="{ADMIN_WEBURLPATH}/index.php?mode=coupon&order=pubtime{$webglobal[file_coupon][searchurl]}" class="special" title="点击按此排序">发布时间<!--{if $webglobal[CPP][order]=='pubtime'}-->↓<!--{/if}--></a></th>
				<th width="10%">管理</th>
			</tr>
		</thead>
		<tbody>
			<!--{if $webglobal[file_coupon][datanum]>0}-->
				<!--{loop $webglobal[file_coupon][dataarray] $tempkey $temptable}-->
					<tr>
						<td{$temptable[tdclass]}><input type="checkbox" name="delid[]" value="{$tempkey}" class="selectUnit" /></td>
						<td{$temptable[tdclass]}>
							<!--{if $temptable[status]==1}-->
								<span class="green">审核通过</span>
							<!--{elseif $temptable[status]==-1}-->
								<span class="dark">已删除</span>
							<!--{else}-->
								待审核
							<!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>
						<!--{if $temptable[image] != ''}-->
						<a rel="example_group" href="{WEBURLPATH}{$temptable[image]}" title=""><img alt="" src="{WEBURLPATH}{$temptable[image]}" height="100px" /></a>
						<!--{else}-->
						<a rel="example_group" href="{WEBURLPATH}/images/no_coupon.gif" title=""><img alt="" src="{WEBURLPATH}/images/no_coupon.gif" /></a>
						<!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>
							<!--{if $temptable[special] > 0}--><strong class="m-success"></strong><!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>
							<!--{if isset($webglobal[file_coupon][category][$temptable[coupon_category_id]])}-->{$webglobal[file_coupon][category][$temptable[coupon_category_id]][name]}<!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>
							<!--{if isset($webglobal[file_coupon][company][$temptable[company_id]])}--><a href="{ADMIN_WEBURLPATH}/index.php?mode=companyedit&editid={$temptable[company_id]}">{$webglobal[file_coupon][company][$temptable[company_id]][name]}({$webglobal[file_coupon][company][$temptable[company_id]][english_name]})</a><!--{/if}-->
						</td>
						<td{$temptable[tdclass]}>
							名称：{$temptable[name]}<br />
							原价：{$temptable[original]} - 优惠价: {$temptable[price]}<br/>
							开始时间: {$temptable[starttime_show]}<br/>
							结束时间: {$temptable[endtime_show]}<br />
							<strong>收藏次数:</strong> {$temptable[favorites_num]}
						</td>
						<td{$temptable[tdclass]}>
							{$temptable[pubtime_show]}
						</td>
						<td{$temptable[tdclass]}>
							<a href="{ADMIN_WEBURLPATH}/index.php?mode=couponedit&editid={$tempkey}&gourl={$webglobal[file_coupon][gourlencode]}" class="special">[编辑]</a>
							<!--{if $temptable[status]==-1}-->
								&nbsp;<!-- <a href="javascript:common_ConfirmGoUrl('确定要从数据库中删除该商铺么？','{ADMIN_WEBURLPATH}/index.php?mode=coupondel&id={$tempkey}&gourl={$webglobal[file_coupon][gourlencode]}')" class="special">[删除]</a> -->
							<!--{/if}-->
						</td>
					</tr>
				<!--{/loop}-->
			<!--{else}-->
				<tr><td colspan="11" style="text-align: center">还没有优惠劵。</td></tr>
			<!--{/if}-->
		</tbody>
	</table>

	<!--{if $webglobal[file_coupon][datanum]>0}-->
		<input type="hidden" name="access" id="access" value="update">
		<table style="width:100%;border-style:none;" cellpadding="0" cellspacing="0">
			<tr>
				<td>
				<input onclick="selectallbutton()" type="button" value="全选">
				<input type="button" name="deletesubmit" id="deletesubmit" value=" 批量删除 " />
				<input type="submit" name="adminsubmit" value=" 批量审核 " id="updatesubmit" />
				<input type="submit" name="adminsubmit" value=" 批量取消 " id="downsubmit" />
				</td>
				<input id ="selecthidden" type="hidden" value="0" />
				<!-- <td style="width:80px;margin:0;padding:0;"><input type="button" id="adminaudit" name="adminaudit" value=" 自动审核优惠劵 " /></td> -->
				<td style="text-align:right;margin:0;padding:5px 0;">{template page}</td>
			</tr>
		</table>
	<!--{/if}-->
	</form>
	<script type="text/javascript">
		function selectallbutton() {
			if($('#selecthidden').val()==0){
				$('#selecthidden').val('1');
			}else{
				$('#selecthidden').val('0');
			}
			$('.selectUnit').each(function(){
				if($('#selecthidden').val()=='1'){
					$(this).attr('checked',true);
				}else{
					$(this).attr('checked',false);
				}
			});
		}
		$(document).ready(function() {
			$("a[rel=example_group]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			$('#adminaudit').click(function() {
				//$('#audit').overlay('load', '系统正在自动审核优惠劵,请稍后...');
				$("body").lightbox('come soon...');
			});

			function selectall() {
				$('.selectUnit').each(function(){
					if($('.selectAll').attr('checked')){
						$(this).attr('checked',true);
					}else{
						$(this).attr('checked',false);
					}
				});
			}
			$('.selectAll').bind('click', selectall);
			$('#deletesubmit').click(function(){
				if(confirm('确认删除')){
					$('#access').val('delete');
					$('#couponform').submit();
				}else{
					return false;
				}
			});
			$('#updatesubmit').click(function(){
				$('#access').val('update');
			});
			$('#downsubmit').click(function(){
				$('#access').val('down');
			});downsubmit
		});
	</script>
<!--{/if}-->

{template footer}